data.txt is assumed to be in current directory. You can even specify the path.

=======================================================

#include <stdio.h>

int main(void)
{
    int ret = 0;
    if ((ret = rename("data.txt","test.txt")) != 0)
        fprintf(stderr, "Error in renaming, return code: %d", ret);
    return 0;

}